//
//  CollectBrandModel.swift
//  Pods
//
//  Created by eme on 2017/3/30.
//
//

import Foundation
import SwiftyJSON
import ModelProtocol

class CollectBrandModel: ModelProtocol{
    
    // MARK: Declaration for string constants to be used to decode and also serialize.
    internal let kCollectBrandBrnameKey: String = "brname"
    internal let kCollectBrandBrlogourlKey: String = "brlogourl"
    internal let kCollectBrandBdidKey: String = "bdid"
    internal let kCollectBrandCrdateKey: String = "crdate"
    internal let kCollectBrandCidKey: String = "cid"
    internal let kCollectBrandBrinfourlKey: String = "brinfourl"
    internal let kCollectBrandBrinfoKey: String = "brinfo"
    internal let kCollectBrandSortnumKey: String = "sortnum"
    internal let kCollectBrandUseridKey: String = "userid"
    internal let kCollectBrandBrcodeKey: String = "brcode"
    internal let kCollectBrandSelfidKey: String = "selfid"
    internal let kCollectBrandBridKey: String = "brid"
    internal let kCollectBrandBriseffectiveKey: String = "briseffective"
    internal let kCollectBrandSendtypeKey: String = "sendtype"
    internal let kCollectCountKey: String = "count"
    
    
    // MARK: 属性
    var brname: String
    var brlogourl: String
    var bdid: String
    var crdate: String
    var cid: Int
    var brinfourl: String
    var brinfo: String
    var sortnum: Int
    var userid: Int
    var brcode: String
    var selfid: String
    var brid: String
    var briseffective: String
    var sendtype: String
    var isclicked:Int = 0
    var count:Int
    
    
    // MARK: 实现MikerSwiftJSONAble 协议， 解析json数据
    required  init?(json: JSON) {
        brname = json[kCollectBrandBrnameKey].stringValue
        brlogourl = json[kCollectBrandBrlogourlKey].stringValue
        bdid = json[kCollectBrandBdidKey].stringValue
        crdate = json[kCollectBrandCrdateKey].stringValue
        cid = json[kCollectBrandCidKey].intValue
        brinfourl = json[kCollectBrandBrinfourlKey].stringValue
        brinfo = json[kCollectBrandBrinfoKey].stringValue
        sortnum = json[kCollectBrandSortnumKey].intValue
        userid = json[kCollectBrandUseridKey].intValue
        brcode = json[kCollectBrandBrcodeKey].stringValue
        selfid = json[kCollectBrandSelfidKey].stringValue
        brid = json[kCollectBrandBridKey].stringValue
        briseffective = json[kCollectBrandBriseffectiveKey].stringValue
        sendtype = json[kCollectBrandSendtypeKey].stringValue
        count = json[kCollectCountKey].intValue
    }
    
    
    /**
     Generates description of the object in the form of a NSDictionary.
     - returns: A Key value pair containing all valid values in the object.
     */
    internal func dictionaryRepresentation() -> [String : AnyObject ] {
        
        var dictionary: [String : AnyObject ] = [ : ]
        dictionary.updateValue(brname as AnyObject, forKey: kCollectBrandBrnameKey)
        dictionary.updateValue(brlogourl as AnyObject, forKey: kCollectBrandBrlogourlKey)
        
        dictionary.updateValue(bdid as AnyObject, forKey: kCollectBrandBdidKey)
        
        
        dictionary.updateValue(crdate as AnyObject, forKey: kCollectBrandCrdateKey)
    
    
        dictionary.updateValue(cid as AnyObject, forKey: kCollectBrandCidKey)
    
    
        dictionary.updateValue(brinfourl as AnyObject, forKey: kCollectBrandBrinfourlKey)
    
    
        dictionary.updateValue(brinfo as AnyObject, forKey: kCollectBrandBrinfoKey)
    
    
        dictionary.updateValue(sortnum as AnyObject, forKey: kCollectBrandSortnumKey)
    
    
        dictionary.updateValue(userid as AnyObject, forKey: kCollectBrandUseridKey)
    
    
        dictionary.updateValue(brcode as AnyObject, forKey: kCollectBrandBrcodeKey)
    
    
        dictionary.updateValue(selfid as AnyObject, forKey: kCollectBrandSelfidKey)
    
   
        dictionary.updateValue(brid as AnyObject, forKey: kCollectBrandBridKey)
    
    
        dictionary.updateValue(briseffective as AnyObject, forKey: kCollectBrandBriseffectiveKey)
    
    
        dictionary.updateValue(sendtype as AnyObject, forKey: kCollectBrandSendtypeKey)
    
   
        dictionary.updateValue(count as AnyObject, forKey: kCollectCountKey)
        
        
        return dictionary
    }
    
    
}
